import 'package:flutter/material.dart';
import 'package:flutter_app/components/max_video_card.dart';
import 'package:flutter_app/components/root_page_head.dart';
import 'package:flutter_app/view/sub_page/max_video_page.dart';
import 'package:flutter_app/view/sub_page/video_page.dart';

class TinyRadioPage extends StatefulWidget {
  TinyRadioPage({Key key}) : super(key: key);

  @override
  TinyRadioPageState createState() => TinyRadioPageState();
}

const List<Tab> _tabs = [Tab(text: '小视频'), Tab(text: '视频')];

final List<Widget> _tabContent = [VideoPage(), MaxVideoPage()];

class TinyRadioPageState extends State<TinyRadioPage>
    with TickerProviderStateMixin {
  TabController _tabController;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _tabController =
        TabController(initialIndex: 1, length: _tabs.length, vsync: this);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: RootPage(),
        bottom: TabBar(
          tabs: _tabs,
          controller: _tabController,
          isScrollable: true, //滚动
        ),
      ),
      body: TabBarView(
        children: _tabContent,
        controller: _tabController,
      ),
    );
  }
}
